<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>回溯管理</title>
    <meta name="description" content="回溯管理平台">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="../../assets/img/main/liantongLOGO.jpg">
    <link rel="stylesheet" href="../../assets/libs/element-ui.css">
</head>

<body page-text="用户管理">
    <div id="main">
        <div class="app-container">
            <el-row :gutter="10" class="mb8" style="margin-bottom:10px;">
                <el-col :span="1.5">
                    <el-button type="primary" icon="el-icon-plus" size="mini" 
                    @click="handleAdd"
                    v-hasPermi="['monitor:job:add']">新增</el-button>
                </el-col>
                <el-col :span="1.5">
                    <el-button type="success" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
                        v-hasPermi="['monitor:job:edit']">修改</el-button>
                </el-col>
                <el-col :span="1.5">
                    <el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple"
                        @click="handleDelete" v-hasPermi="['monitor:job:remove']">删除</el-button>
                </el-col>

                <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
            </el-row>
            <!-- 表格 -->
            <el-table ref="multipleTable" :data="jobList"  style="width: 100%"
                @selection-change="handleSelectionChange">
                <el-table-column type="selection" width="55">
                </el-table-column>
                <el-table-column label="任务编号"  prop="jobId" width="120"></el-table-column>
                <el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" ></el-table-column>
                <el-table-column label="任务组名" align="center" prop="jobGroup" :formatter="jobGroupFormat"></el-table-column>
                <el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" ></el-table-column>
                <el-table-column label="cron执行表达式" align="center" prop="cronExpression" :show-overflow-tooltip="true"></el-table-column>
                <el-table-column label="状态" align="center">
                    <template slot-scope="scope">
                    <el-switch
                        v-model="scope.row.status"
                        active-value="0"
                        inactive-value="1"
                        @change="handleStatusChange(scope.row)"
                    ></el-switch>
                    </template>
                </el-table-column>
                <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                    <template slot-scope="scope">
                    <el-button
                        size="mini"
                        type="text"
                        icon="el-icon-caret-right"
                        @click="handleRun(scope.row)"
                        v-hasPermi="['monitor:job:edit']"
                    >执行一次</el-button>
                    <el-button
                        size="mini"
                        type="text"
                        icon="el-icon-view"
                        @click="handleView(scope.row)"
                        v-hasPermi="['monitor:job:query']"
                    >详细</el-button>
                    </template>
                </el-table-column>
            </el-table>


            <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum"
                :limit.sync="queryParams.pageSize" @pagination="getList" />

            <!-- 添加或修改定时任务对话框 -->
            <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
                <el-form ref="form" :model="form" :rules="rules" label-width="120px">
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="任务名称" prop="jobName">
                                <el-input v-model="form.jobName" placeholder="请输入任务名称" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="任务分组" prop="jobGroup">
                                <el-select v-model="form.jobGroup" placeholder="请选择">
                                    <el-option label="默认" value="DEFAULT"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="24">
                            <el-form-item prop="invokeTarget">
                                <span slot="label">
                                    调用方法
                                    <el-tooltip placement="top">
                                        <div slot="content">
                                            Bean调用示例：task.checkQualityParams(''000000'' ,''5'',''2020-08-01'',''2020-08-31'',''admin'')
                                            <br />参数说明：('机构代码',' 抽检比例', '开始时间', '结束时间', '用户id')
                                        </div>
                                        <i class="el-icon-question"></i>
                                    </el-tooltip>
                                </span>
                                <el-input v-model="form.invokeTarget" placeholder="请输入调用目标字符串" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="cron表达式" prop="cronExpression">
                                <el-input v-model="form.cronExpression" placeholder="请输入cron执行表达式" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="是否并发" prop="concurrent">
                                <el-radio-group v-model="form.concurrent" size="small">
                                    <el-radio-button label="0">允许</el-radio-button>
                                    <el-radio-button label="1">禁止</el-radio-button>
                                </el-radio-group>
                            </el-form-item>
                        </el-col>
                        <el-col :span="24">
                            <el-form-item label="错误策略" prop="misfirePolicy">
                                <el-radio-group v-model="form.misfirePolicy" size="small">
                                    <el-radio-button label="1">立即执行</el-radio-button>
                                    <el-radio-button label="2">执行一次</el-radio-button>
                                    <el-radio-button label="3">放弃执行</el-radio-button>
                                </el-radio-group>
                            </el-form-item>
                        </el-col>
                        <el-col :span="24">
                            <el-form-item label="状态">
                                <el-radio-group v-model="form.status">
                                    <el-radio label="0">正常</el-radio>
                                    <el-radio label="1">暂停</el-radio>
                                </el-radio-group>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="submitForm">确 定</el-button>
                    <el-button @click="cancel">取 消</el-button>
                </div>
            </el-dialog>
            <el-dialog title="任务详细" :visible.sync="openView" width="700px" append-to-body>
		      <el-form ref="form" :model="form" label-width="120px" size="mini">
		        <el-row>
		          <el-col :span="12">
		            <el-form-item label="任务编号：">{{ form.jobId }}</el-form-item>
		            <el-form-item label="任务名称：">{{ form.jobName }}</el-form-item>
		          </el-col>
		          <el-col :span="12">
		            <el-form-item label="任务分组：">{{ jobGroupFormat(form) }}</el-form-item>
		            <el-form-item label="创建时间：">{{ form.createTime }}</el-form-item>
		          </el-col>
		          <el-col :span="12">
		            <el-form-item label="cron表达式：">{{ form.cronExpression }}</el-form-item>
		          </el-col>
		          <el-col :span="12">
		            <el-form-item label="下次执行时间：">{{ form.nextValidTime }}</el-form-item>
		          </el-col>
		          <el-col :span="24">
		            <el-form-item label="调用目标方法：">{{ form.invokeTarget }}</el-form-item>
		          </el-col>
		          <el-col :span="12">
		            <el-form-item label="任务状态：">
		              <div v-if="form.status == 0">正常</div>
		              <div v-else-if="form.status == 1">失败</div>
		            </el-form-item>
		          </el-col>
		          <el-col :span="12">
		            <el-form-item label="是否并发：">
		              <div v-if="form.concurrent == 0">允许</div>
		              <div v-else-if="form.concurrent == 1">禁止</div>
		            </el-form-item>
		          </el-col>
		          <el-col :span="12">
		            <el-form-item label="执行策略：">
		              <div v-if="form.misfirePolicy == 0">默认策略</div>
		              <div v-else-if="form.misfirePolicy == 1">立即执行</div>
		              <div v-else-if="form.misfirePolicy == 2">执行一次</div>
		              <div v-else-if="form.misfirePolicy == 3">放弃执行</div>
		            </el-form-item>
		          </el-col>
		        </el-row>
		      </el-form>
		      <div slot="footer" class="dialog-footer">
		        <el-button @click="openView = false">关 闭</el-button>
		      </div>
		    </el-dialog>
        </div>
    </div>
    <script src="../../assets/js/util/crypto-js.min.js"></script>
    <script src="../../assets/js/util/Aes.js"></script>
    <script src="../../assets/libs/amazeui/js/jquery.min.js"></script>
    <script src="../../assets/libs/vue/vue.min.js"></script>
    <script src="../../assets/js/util/inner.js?v2017010301"></script>
    <script src="../../assets/js/util/pagination.js?v2017010301"></script>
    <script src="../../assets/env.js?v2017010301"></script>
    <script src="../../assets/js/laydate-v1.1/laydate/laydate.js"></script>
    <script src="../../assets/js/util/common.js?v2017010301"></script>
    <script src="../../assets/libs/axios.min.js"></script>
    <script src="../../assets/libs/vue/vue.min.js"></script>
    <script src="../../assets/libs/element-ui.js"></script>
    <script src="../../assets/js/biz/sys/dingshirenwu/timetask.js"></script>
    <style>
        .phone_type {
            /* overflow: hidden; */
            width: 160px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .theme-white .tpl-table-black thead>tr>td {
            font-size: 12px;
            padding: 5px;
        }
    </style>

</body>

</html>